<template>
  <div class="personal_purse">
    <!-- <my-header :showBack="true" title="奖金"></my-header> -->
		<div class="ass_top">
      <div class="head_top">
        <div>
          <i class="iconfont icon-fanhui menu"  @click="goBack"></i>
        </div>
        <div>{{$t("lang.Scoresexchange")}}</div>
        <div class="rightmenu">
          
        </div>
      </div>
    <div class="all_ass">
			<div>
				<h3>{{parseFloat(AssetNum.registerPoint).toFixed(3)||"0.00"}}</h3>
      	<p>{{$t("lang.Seedpoints")}}</p>
			</div>
      <div>
				<h3>{{parseFloat(AssetNum.activationPoint).toFixed(3)||"0.00"}}</h3>
      	<p>{{$t("lang.ActivationPoint")}}</p>
			</div>
    </div>
    </div>
		<!-- 02 -->
		<section class="useabble">
			<div class="coinbot asflex">
          <p>{{$t("lang.CoinNumber")}}</p>
          <input type="number" v-model="outNumber" class="coinnum"  :placeholder="$t('lang.enterSNum')">
      </div>
      <div class="coinbot asflex">
          <p>{{$t("lang.scccPword")}}</p>
          <input type="password" v-model="outpayWord" class="coinnum" :placeholder="$t('lang.enterSpword')">
      </div>
			<div class="ce_filed" @click="showSelet">
        <div class="ce_flex">
              <label for="">{{$t("lang.Choosethetype")}}</label> 
            </div>
						<div class="ce_flex">
							<p  :data-id="SetID">{{UpTypeName}}</p>
							<i class="iconfont icon-arrow-right"></i>
				</div>
			</div>
		</section>
		
		<div class="tips">
        <p>{{$t("lang.selectTtype")}}</p>
    </div>
		<div class="sure_btn">
          <van-button type="primary" size="large"  @click="ecchBtn">{{$t("lang.submit")}}</van-button>
    </div>
		<van-actionsheet
        v-model="show"
        :actions="actions"
        :cancel-text="$t('lang.AboutUs')"
        @select="onSelect"
      />

  </div>
</template>

<script>
import header from "@/components/header";
import { Toast } from 'vant';
import ClipboardJS from 'Clipboard'


export default {
  components: {
		"my-header": header,
  }, 
  data(){
    return{
			userInfo:{},

      showLeftProp: false,
			AssetNum: {},
			UpTypeName:"",
      SetID:"",
      outNumber:"",
      outpayWord:"",
      

      show:false,
      actions: [{name: this.$t('lang.ActivationPoint'),type:1},{name:this.$t('lang.RegisterPoint'),type:2}, ]
    }
  },
  filters: {
    formatDate(time) {
      var date = new Date(time);
      return timeFormat.formatDate(date, "yyyy.MM.dd hh:mm");
    }
  },
  mounted(){
    this.selectAccount();
  },
  methods:{
		showProp(){
      this.showLeftProp=true;
    },
    closeProp(){
      this.showLeftProp=false;
    },
    selectAccount(){
			// 个人钱包信息
      this.$ajax(this.$api.childAccount).then(
        res=>{
          if(res.code==0){
            this.AssetNum=res.msg;
          }
        }
      )
    },
    onSelect(item) {
      // 点击选项时默认不会关闭菜单，可以手动关闭
      this.show = false;
      Toast(item.name);
      this.UpTypeName=item.name;
      this.SetID=item.type;
    },
    showSelet(){
      this.show=true;
    },
    ecchBtn(){
      if(this.SetID==""){
        Toast({ message: this.$t('lang.plaseselecttype'), position: "bottom" });
        return;
      }
      console.log(this.SetID)
      if (!this.$validator.isInt(this.outNumber)) {
        Toast({ message: this.$t('lang.EnterTrueNum'), position: "bottom" });
        return;
      }
      if (this.outpayWord=='') {
        Toast({ message: this.$t('lang.enterSpword'), position: "bottom" });
        return;
      }
      if (!this.$validator.isPassword(this.outpayWord)) {
        Toast({ message: this.$t('lang.truepayPass'), position: "bottom" });
        return;
      }
      // POST /api/child/transferToAccount
      this.$ajax(this.$api.transferToAccount, {payPass:this.outpayWord,amount:this.outNumber,type:this.SetID,}).then(res => {
        if (res.code === 0) {
          Toast({ message: this.$t('lang.CZsuccessful'), position: "bottom" });
          this.outNumber="";
          this.outpayWord="";
          this.selectAccount();
        }else{
          Toast({ message: res.msg, position: "bottom" });
        }
      });
    },
  }
}
</script>

<style lang='less' scoped>
.ass_top{background: url(../../assets/img/assetIndex/grzx_dhzx.png)}
.all_ass{
	text-align: center;padding:5vh 0;display: flex;justify-content:space-between;
	div{flex: 1;}
  h3{color: #E1AF56;font-size: 24px;line-height: 30px;}
  p{color: #AA7A24;}
}
// head_top
.head_top{
	width: 100%;
  height: 44px;
	line-height: 44px;
  font-size: 16px;
  color: #ffffff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  background: transparent;      
}
.head_top .menu{font-size: 20px;}
.head_top i{
  padding:10px;
  font-size: 14px;
}
.head_top div:nth-child(1) {
  width:20%;
  box-sizing: border-box;
}
.head_top div:nth-child(2) {
  width:60%;
  text-align:center;
}
.head_top div:nth-child(3) {
  width:20%;
  text-align:center;
  font-size:12px;
}
// 
.personal_purse{
		background: #ffffff;
}
.trad_list{
		box-sizing: border-box;padding:0px 12px;background:#ffffff;margin-top:0px;
		h3{color: #333333;line-height: 26px;}
		li{padding: 10px 0;border-bottom: 1px solid #eeeeee;}
		.nflex{display: flex;justify-content:space-between ;
			p{line-height: 20px;color: #999999;}
			span{color: #333333;}
			.npadd{padding: 15px 0;}
			.tiphui{color: #999999;}
			.tipred{color: #FF5458;}
			.tipgren{color: #00BA4F;}
		}
		.buybtn{color: #FF4954;border: 1px solid #FF4954;border-radius: 20px;padding: 0 6px ;}		
}
.jytime{
	h3{color: #333333;font-size: 14px;}
	p{color: #CCCCCC;}
}
.myass_info{
	ul{
		li{display: flex;justify-content:space-between;box-sizing: border-box;padding: 12px 12px;border-bottom: 1px solid #eeeeee;background: #ffffff;}
		p:nth-child(1){color: #333333;}
		p:nth-child(2){color: #333333;}
	}
}
.tips{color: #EB0700;padding: 12px;}
.ce_filed{display: flex;justify-content:space-between ;box-sizing: border-box;padding: 10px 0px;border-bottom: 1px solid #eeeeee;background: #ffffff;}
.ce_filed label{max-width: 110px!important;width: 110px;text-align: left;}
.ce_flex{display: flex;justify-content:space-between;align-items:center;}
.ce_flex p{flex: 2;text-align: right;}
.mywallflex{
  display: flex;
  .van-button{margin: 0 10px;}
}
// 输入框
.useabble{
  box-sizing: border-box;padding:0 12px;
  input{width: 100%;border:none;height: 30px;}
  .coinnum{font-size: 16px;background: #ffffff;margin-bottom: 10px;}
  .coinbot{
    border-bottom: 1px solid #eeeeee;padding: 10px 0 0px 0;
    p{padding-bottom: 5px;color: #333333;font-size: 14px;}
		}
	.asflex{
		display: flex;align-items:center;
		p{width: 110px;}
	}	
}
</style>
